home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Classicos / BallBreaker.swf / scripts / frame_12 / PlaceObject2_79_3 / CLIPACTIONRECORD onClipEvent(enterFrame).as
Encoding:
Text File  |  2006-06-13  |  2.9 KB  |  113 lines

  1. onClipEvent(enterFrame){
  2.    if(_root.vars.gameon == 1)
  3.    {
  4.       quarter = _width / 4;
  5.       leftpoint = 2 * quarter;
  6.       rightpoint = 2 * quarter;
  7.       if(key.isdown(key.LEFT))
  8.       {
  9.          if(1 + leftpoint < _X)
  10.          {
  11.             this._x -= eval("_root.vars.:boardmove");
  12.          }
  13.          else
  14.          {
  15.             this._x = 0 + rightpoint;
  16.          }
  17.       }
  18.       if(key.isdown(key.RIGHT))
  19.       {
  20.          if(_X < 318 - rightpoint)
  21.          {
  22.             this._x += eval("_root.vars.:boardmove");
  23.          }
  24.          else
  25.          {
  26.             this._x = 319 - rightpoint;
  27.          }
  28.       }
  29.       if(key.isdown(key.SPACE))
  30.       {
  31.          if(_root.vars.gun == 1 and _root.vars.bullet == 0)
  32.          {
  33.             _root.vars.bullet = 1;
  34.             duplicateMovieClip(_root.bullet,"bullet1",18384);
  35.             _root.bullet1._x = _X;
  36.             _root.bullet1._y = _Y;
  37.          }
  38.       }
  39.       if(key.isdown(key.SHIFT))
  40.       {
  41.          _root.vars.shiftpressed += 1;
  42.          if(_root.vars.shiftpressed < 10)
  43.          {
  44.             _root.ball._x -= 4;
  45.          }
  46.       }
  47.       if(this.hitTest(_root.ball))
  48.       {
  49.          if(_root.vars.fireball == 1)
  50.          {
  51.             _root.ball._y = _Y - 14;
  52.          }
  53.          else
  54.          {
  55.             _root.ball._y = _Y - 10;
  56.          }
  57.          if(_root.ball._x < _X and _X - quarter < _root.ball._x)
  58.          {
  59.             if(eval("_root.vars.:ballx") < 0)
  60.             {
  61.                set("_root.vars.:bally",-3.5);
  62.                set("_root.vars.:ballx",-1.5);
  63.             }
  64.             else
  65.             {
  66.                set("_root.vars.:bally",-3.5);
  67.                set("_root.vars.:ballx",-1.5);
  68.             }
  69.          }
  70.          if(_X < _root.ball._x and _root.ball._x < _X + quarter)
  71.          {
  72.             if(eval("_root.vars.:ballx") < 0)
  73.             {
  74.                set("_root.vars.:bally",-3.5);
  75.                set("_root.vars.:ballx",1.5);
  76.             }
  77.             else
  78.             {
  79.                set("_root.vars.:bally",-3.5);
  80.                set("_root.vars.:ballx",1.5);
  81.             }
  82.          }
  83.          if(_root.ball._x < _X - quarter)
  84.          {
  85.             if(eval("_root.vars.:ballx") < 0)
  86.             {
  87.                set("_root.vars.:ballx",-3);
  88.                set("_root.vars.:bally",-3);
  89.             }
  90.             else
  91.             {
  92.                set("_root.vars.:ballx",-3);
  93.                set("_root.vars.:bally",-3);
  94.             }
  95.          }
  96.          if(_X + quarter < _root.ball._x)
  97.          {
  98.             if(eval("_root.vars.:ballx") < 0)
  99.             {
  100.                set("_root.vars.:ballx",3);
  101.                set("_root.vars.:bally",-3);
  102.             }
  103.             else
  104.             {
  105.                set("_root.vars.:ballx",3);
  106.                set("_root.vars.:bally",-3);
  107.             }
  108.          }
  109.          _root.sounds.ballhitship_sfx.start(0.09,1);
  110.       }
  111.    }
  112. }
  113.